﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommandLogic.Interface;
using BlockLogic.Impl.Controller;
using BlockLogic.Interface.Blocks;

namespace CommandLogic.Impl
{
    class DisconnectBlocksCommand : ICommandLogic
    {
        private static DisconnectBlocksCommand instance = new DisconnectBlocksCommand();

        private DisconnectBlocksCommand() { }

        public static DisconnectBlocksCommand getInstance()
        {
            return instance;
        }

        public Dictionary<string, object> execute(Dictionary<string, object> param)
        {
            var idOutput = (Guid)param["idoutput"];
            var idInput = (Guid)param["idinput"];

            var blockController = BlockController.GetInstance();

            var inputBlock = (IInputBlock)blockController[idInput];
            var outputBlock = (IOutputBlock)blockController[idOutput];

            blockController.Disconnect(inputBlock, outputBlock);

            return null;
        }
    }
}
